A repository enables the storage and reuse of information about an enterprise. Such information could be definitional (such as programs, files, and the relationships therebetween), management information (e.g., who can see certain types of information, etc.) and operational information (such as schedules, processes, etc.) In an object-oriented repository, this information is stored as objects that have data (e.g., name, salary, etc.) and behavior (e.g., change salary, etc.). The C++ language, with its object-oriented syntax is well suited as an interface to an object-oriented repository. For more information on such an interface reference is made to a co-pending patent application by Peter Johnson for A METHOD FOR PROVIDING OBJECT DATABASE INDEPENDENCE IN A PROGRAM WRITTEN USING THE C++ PROGRAMMING LANGUAGE, Ser. No. 08/505,140, filed Jul. 21, 1995; which application is assigned to the same assignee hereof.
However, having just a C++ interface limits the types of programs (or tools) that can have access to the object-oriented repository to only those programs written in the C++ language. It would be beneficial to have an interface that would allow access to the object-oriented repository by programs written in the C language. In addition, programs written in languages that can access dynamic link libraries (DLL's on Windows NT), or shared objects (UNIX), will benefit from access to an object-oriented repository by use of the method of the present invention. Examples of such language include Visual Basic, Smalltalk and other similar languages.
A problem with C interfaces to object-oriented databases is that the functions provided are not tailored to the types in the database. For example, in some implementations in order to create an object in the database, the C program must first call the database to retrieve a representation of the desired type, then call a generic create function to create the object. The method of the present invention solves this problem by generating functions tailored to each of the types in a model in the repository. One function call is required to create an object of a specific type. Similarly, one function call is used to access the properties and operations of types in the repository
Another problem with C interfaces to object-oriented databases is that the functionality available through the C interface is limited compared to the C++ interface to the same object-oriented database. This invention provides almost 100% of the functionality available through the public C++ interface to the repository.
Still another problem is that the C and C++ interfaces can be constructed quite differently with much of the object-orientedness of the types in the database being lost when translated to C. The method of the present invention provides a C interface that maps the C++ types, operations and properties in a straightforward manner to the C language. This reduces the amount of documentation necessary for both interfaces, as well as programmer learning time going from one interface to the other.
The present invention provides a C interface to an object oriented repository by making the public properties and operations of the types in the repository available to programs written in the C language, or accessed via DLLs, or shared objects from other languages. A program written in the C language can open an object-oriented repository, log in to the repository, begin a repository session, and create, retrieve, and modify instances of the types in the repository. The purpose of the method of the present invention is to convert the types, properties, and operations defined for a model into constructs understood by a C compiler, for example. The Application Program Interface (API) for the C binding includes a set of header files that contain the C type and function declarations necessary to access instances of the types in the object-oriented repository. A set of C++ files provides a wrapping between the C functions that can be called by a program written in the C language and the C++ interface provided by the object-oriented repository.